package org.ldh.service.impl;

import org.ldh.dao.UserDao;
import org.ldh.dao.impl.UserDaoImpl;
import org.ldh.domain.User;
import org.ldh.service.UserService;

import java.util.List;

/**
 * 用户的业务层实现类
 */
public class UserServiceImpl implements UserService {
    //调用dao层
    UserDao userDao = new UserDaoImpl();
    @Override
    public User findByNameAndPass(String username, String password) {
        return userDao.findByNameAndPass(username,password);
    }

    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public void save(User user) {
        userDao.save(user);
    }

    @Override
    public User findById(String id) {
        return userDao.findById(id);
    }

    @Override
    public void deleteById(String id) {
        userDao.deleteById(id);
    }

    @Override
    public void update(User user) {
        userDao.update(user);
    }

    @Override
    public void updatePassByName(String username, String password) {
        userDao.updatePassByName(username,password);
    }
}
